/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package java_project;
import JavaSource.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author 
 */
public class TEST extends javax.swing.JFrame {

    /**
     * Creates new form TEST
     */
    public TEST() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jButton1.setText("jButton1");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jTable1.setBackground(new java.awt.Color(255, 0, 0));
        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, "", null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addGap(391, 391, 391))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 88, Short.MAX_VALUE)
                .addComponent(jButton1)
                .addGap(69, 69, 69))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            // TODO add your handling code here:
           // FOS.loadSystem();
            //jTable1.setBackground(new java.awt.Color(255, 0, 0));
            Customer c1=new Member("Siqi Kang", "connie0622@ufl.edu","asd","3522222222",false,"12345678",1,1000,"44444444");
            Customer c2=new Customer("Yiming Wang", "dachui@ufl.edu","asd","3533333333", true, "87654321");
            Customer c3=new Customer("Zhong Huang", "zhonghuang@ufl.edu", "3800 sw 34th st apt.dd304","3524444444", true, "88888888");
            //Member m1 = new Member("Obama","obama@whitehouse.com","white house","3522786620",true,"88888888");
            
            //Employee e1=new Employee("Siqi Kang", 3, false, "3522817178","12345678");
            Employee e2=new Employee("Funing Teng", 3, true, "3522817178","12345678");
            Employee e3=new Employee("Zun Huang", 2, true, "3522817178","12345678");
            Employee e4=new Employee("Xiaosi Xu", 1, false, "3522817178","12345678");
            Employee e5=new Employee("Xilan Ding", 0, false, "3522817178","12345678");
            
//            Dish d1 = new Dish("potato and tomato",12.3,true);
//            Dish d2 = new Dish("Chicken Claw in Black Bean Saucespicy",7.8,true);
//            Dish d3 = new Dish("Szechuan Chili Wonton",13.3,true);
//            Dish d4 = new Dish("Pig Ear in Garlic Vinegar Saucespicy",22.3,true);
//            Dish d5 = new Dish("Bamboo Fungus Home-Made Soup",11.35,true);
//            Dish d6 = new Dish("Spicy Beef Noodle Soupspicy",16.3,true);
//            Dish d7 = new Dish("Kong Pung Chicken Rice Bowlspicy",9.3,true);
//            Dish d8 = new Dish("Seafood &Tofu w. Sacha in Hot Potspicy",10.3,true);
//            Dish d9 = new Dish("House Special Pepper Fish Fillet w. Tomato (Hot Pot)spicy",14.3,true);
//            Dish d10 = new Dish("Oyster with Tofu in Hot Pot",18.3,true);
            
            
//            LinkedList<Dish> test1 = new LinkedList();
//            test1.add(d9);
//            test1.add(d8);
//            test1.add(d3);
            //DateFormat dt =new SimpleDateFormat("mm/dd/yyyy");
            
            //int orderType, Date orderDate, Customer customer, LinkedList<Dish> orderDishes, String specialRec, int orderStatus,double totalPrice
//            Order od1 = new Order(1,new Date(),c1,test1,"lala",2,37.9);
//            Order od2 = new Order(2,new Date(),c2,test1,"lerera",3,37.9);
//            
//            
//            FOS.getOrderList().add(od1);
//            FOS.getOrderList().add(od2);
            
//            FOS.getDishList().add(d10);
//            FOS.getDishList().add(d9);
//            FOS.getDishList().add(d8);
//            FOS.getDishList().add(d7);
//            FOS.getDishList().add(d6);
//            FOS.getDishList().add(d5);
//            FOS.getDishList().add(d4);
//            FOS.getDishList().add(d3);
//            FOS.getDishList().add(d2);
//            FOS.getDishList().add(d1);
            
//            Order o1 = new Order();
//            Order o2 = new Order();
//            Order o3 = new Order();
//            Order o4 = new Order();
//            Order o5 = new Order();
//            Order o6 = new Order();
            
//            FOS.getOrderList().add(o1);
//            FOS.getOrderList().add(o2);
//            FOS.getOrderList().add(o3);
//            FOS.getOrderList().add(o4);
//            FOS.getOrderList().add(o5);
//            FOS.getOrderList().add(o6);

            
           // FOS.getEmployeeList().add(e1);
            FOS.getEmployeeList().add(e2);
            FOS.getEmployeeList().add(e3);
            FOS.getEmployeeList().add(e4);
            FOS.getEmployeeList().add(e5);
            
            FOS.getCustList().add(c1);
            FOS.getCustList().add(c2);
            FOS.getCustList().add(c3);
            
            
            
            boolean b=FOS.saveSystem(FOS);
            if(b){JOptionPane.showMessageDialog(null, "Successfully saved");
}
           
            
//Coupon cp1=new Coupon("SAVE20", "01/01/2014", "12/31/2014", 0.2);
//Coupon cp2=new Coupon("SUMMER", 05/01/2014, 8/31/2014, 0.25);
//Coupon cp3=new Coupon("SPRING", 02/01/2014, 4/31/2014, 0.25);
        } catch (IOException ex) {
            Logger.getLogger(TEST.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(TEST.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_jButton1ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(TEST.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(TEST.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(TEST.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(TEST.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new TEST().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    // End of variables declaration//GEN-END:variables
private FoodOrderingSystem FOS=new FoodOrderingSystem();
}
